package com.tbit.uqbike.service.base;


import com.tbit.common.entity.view.Result;
import com.tbit.uqbike.object.business.MachineImportInfo;
import com.tbit.uqbike.object.business.PageData;
import com.tbit.uqbike.object.pojo.Machine;
import com.tbit.uqbike.object.pojo.MachineBaseInfo;
import com.tbit.uqbike.object.pojo.dto.MachineRemindDTO;
import com.tbit.uqbike.object.pojo.dto.MachineSearchDTO;
import com.tbit.uqbike.object.pojo.vo.BatchMoveMachineReqVO;
import com.tbit.uqbike.object.pojo.vo.BatchOperationMsgVO;
import com.tbit.uqbike.object.pojo.vo.RemindStateVO;
import com.tbit.uqbike.object.value.LoginInfo;
import com.tbit.uqbike.webmanager.req.machine.QueryByPointReq;
import org.springframework.validation.annotation.Validated;

import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * 设备service
 *
 * @author Leon
 * 2017年2月24日 下午4:09:17
 */
public interface MachineService {

    /**
     * 根据类型和用户名查询
     *
     * @param machineNO
     * @return
     */
    Machine getByMachineNO(String machineNO);

    /**
     * 根据设备id查询
     *
     * @param machineId
     * @return
     */
    Machine getByMachineId(Integer machineId);

    /**
     * 根据设备编号批量查询
     *
     * @param machineNOs
     * @return
     */
    List<Machine> getByMachineNOs(List<String> machineNOs);

    /**
     * 根据平台id和设备编号查询
     *
     * @param accountIds
     * @param machineNOs
     * @return
     */
    List<Machine> getByAccountIdAndMachineNOs(List<Integer> accountIds, List<String> machineNOs);

    /**
     * 添加设备
     *
     * @param info
     * @param machineInfoList
     * @param machineType
     * @param accountId
     * @param batteryModelId
     */
    void addMachine(LoginInfo info, List<MachineImportInfo> machineInfoList, Integer machineType, Integer accountId,
                    Integer batteryModelId, Integer secondaryBattertId, Integer[] functionList);

    /**
     * 删除设备
     *
     * @param info
     * @param machineId
     */
    void delMachine(LoginInfo info, Integer machineId);

    void modMachineNO(LoginInfo info, Integer machineId, String machineNO);

    void modUserCode(LoginInfo info, Integer machineId, String userCode, String frame, String license, String motor, String remark);

    PageData<List<MachineBaseInfo>> searchMachine(LoginInfo info,String accountId, String key, String machineNOs,
                                                  Integer rowCount, Integer pageNO, Integer machineType, String frame, String license, String motor,
                                                  Integer dataType,String batteryNo,List<Integer> tagIds,  Integer machineGroupId, Integer type);

    /**
     * 设备导出
     */
    List<MachineBaseInfo> exportMachine(LoginInfo info, Integer accountIds, String key, String machineNOs, Integer machineType, Integer machineGroupId);

    void modMachineStatus(LoginInfo info, List<MachineImportInfo> machineInfoList);

    /**
     * 根据用户码获取设备
     *
     * @param userCode
     */
    Machine getByUserCode(String userCode);

    /**
     * 批量删除
     */
    List<String> deleteBatch(List<String> machineNOs);


    /**
     * 批量删除(用户编号也可以删除)
     */
    List<String> deleteBatchNew(List<String> machineNOs, int dataType,Integer accountId);


    /**
     * 修改车架号等数据
     */
    void modFrame(LoginInfo info, String machineNO, String frame, String license, String motor, String remark);

    /**
     * 批量修改
     *
     * @param info
     * @param list
     */
    BatchOperationMsgVO<String> modBatch(LoginInfo info, List<MachineImportInfo> list);

    List<Machine> getByUserCodes(List<String> userCodes);

    List<Machine> getByAccountIdAndUserCodes(Integer accountId, List<String> userCodes);

    List<Machine> getByIds(Set<Integer> ids);

    List<Machine> getByBrandIdAndAccountId(Integer brandId, Integer accountId);

    List<MachineBaseInfo> loadMachineByPoints(QueryByPointReq req);

    /**
     * 批量划拨设备
     * @param reqVO 请求
     * @return 划拨失败信息
     */
    Map<String, String> batchMoveMachine(@Validated BatchMoveMachineReqVO reqVO);

    BatchOperationMsgVO<String> modBatchv2(LoginInfo info, List<MachineImportInfo> list);

    /**
     * @description: 获取车辆列表
     * @author: mo.shanyong
     * @date: 2024/11/28 14:30
     * @param: machineSearchDTO 搜索参数
     * @return: com.tbit.uqbike.object.business.PageData<java.util.List < com.tbit.uqbike.object.pojo.MachineBaseInfo>>
     */
    PageData<List<MachineBaseInfo>> searchMachineV2(MachineSearchDTO machineSearchDTO);

    /**
     * 批量操作sim提醒状态
     * @param dto dto
     * @return Result<Object>
     */
    Result<Object> updateRemindState(MachineRemindDTO dto);
}